From fee4308bedae69c397b8514c64e5435506776311 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 12 May 2016 18:23:53 +0300 Subject: [PATCH] simplify tests remove ADDING, REMOVING, DOCTEST, DOWNLOADING, PACKAGING, UPLOADING, VERIFYING, ARCHIVING, INSTALLING, REPLACING constants --- tests/support/mod.rs | 11 --- tests/test_cargo_cfg.rs | 8 +- tests/test_cargo_compile_custom_build.rs | 13 ++- tests/test_cargo_cross_compile.rs | 5 +- tests/test_cargo_install.rs | 40 ++++----- tests/test_cargo_overrides.rs | 16 ++-- tests/test_cargo_package.rs | 101 +++++++++------------- tests/test_cargo_publish.rs | 7 +- tests/test_cargo_registry.rs | 103 +++++++++++------------ tests/test_cargo_test.rs | 69 +++++++-------- 10 files changed, 156 insertions(+), 217 deletions(-) diff --git a/tests/support/mod.rs b/tests/support/mod.rs index 3ba8be881..f42057b68 100644 --- a/tests/support/mod.rs +++ b/tests/support/mod.rs @@ -682,14 +682,3 @@ fn substitute_macros(input: &str) -> String { } return result; } - -pub static ADDING: &'static str = " Adding"; -pub static REMOVING: &'static str = " Removing"; -pub static DOCTEST: &'static str = " Doc-tests"; -pub static PACKAGING: &'static str = " Packaging"; -pub static DOWNLOADING: &'static str = " Downloading"; -pub static UPLOADING: &'static str = " Uploading"; -pub static VERIFYING: &'static str = " Verifying"; -pub static ARCHIVING: &'static str = " Archiving"; -pub static INSTALLING: &'static str = " Installing"; -pub static REPLACING: &'static str = " Replacing"; diff --git a/tests/test_cargo_cfg.rs b/tests/test_cargo_cfg.rs index 9e1971107..7ce0e02b1 100644 --- a/tests/test_cargo_cfg.rs +++ b/tests/test_cargo_cfg.rs @@ -4,7 +4,7 @@ use std::fmt; use cargo::util::{Cfg, CfgExpr}; use hamcrest::assert_that; -use support::{project, execs, DOWNLOADING}; +use support::{project, execs}; use support::registry::Package; macro_rules! c { @@ -213,12 +213,12 @@ test!(works_through_the_registry { assert_that(p.cargo_process("build"), execs().with_status(0).with_stdout(&format!("\ [UPDATING] registry [..] -{downloading} [..] -{downloading} [..] +[DOWNLOADING] [..] +[DOWNLOADING] [..] [COMPILING] foo v0.1.0 ([..]) [COMPILING] bar v0.1.0 ([..]) [COMPILING] a v0.0.1 ([..]) -", downloading = DOWNLOADING))); +"))); }); test!(bad_target_spec { diff --git a/tests/test_cargo_compile_custom_build.rs b/tests/test_cargo_compile_custom_build.rs index b88963de4..125e0a341 100644 --- a/tests/test_cargo_compile_custom_build.rs +++ b/tests/test_cargo_compile_custom_build.rs @@ -2,7 +2,6 @@ use std::fs::{self, File}; use std::io::prelude::*; use support::{project, execs}; -use support::{DOCTEST}; use support::paths::CargoPathExt; use hamcrest::{assert_that, existing_file, existing_dir}; @@ -482,14 +481,14 @@ running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured -{doctest} foo +[DOCTEST] foo [RUNNING] `rustdoc --test [..]` running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured -", doctest = DOCTEST))); +"))); println!("doc"); assert_that(p.cargo("doc").arg("-v"), @@ -1331,7 +1330,7 @@ test test_bar ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -{doctest} foo +[DOCTEST] foo [RUNNING] [..] --cfg foo[..] running 1 test @@ -1339,7 +1338,7 @@ test foo_0 ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -", dir = p.url(), doctest = DOCTEST))); +", dir = p.url()))); }); test!(cfg_doc { @@ -1445,7 +1444,7 @@ test test_bar ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -{doctest} foo +[DOCTEST] foo [RUNNING] [..] --cfg foo[..] running 1 test @@ -1453,7 +1452,7 @@ test foo_0 ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -", dir = p.url(), doctest = DOCTEST))); +", dir = p.url()))); }); test!(cfg_override_doc { diff --git a/tests/test_cargo_cross_compile.rs b/tests/test_cargo_cross_compile.rs index 3b3763419..51e406a5a 100644 --- a/tests/test_cargo_cross_compile.rs +++ b/tests/test_cargo_cross_compile.rs @@ -1,7 +1,6 @@ use std::env; use support::{project, execs, basic_bin_manifest}; -use support::{DOCTEST}; use hamcrest::{assert_that, existing_file}; use cargo::util::process; @@ -505,14 +504,14 @@ running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured -{doctest} foo +[DOCTEST] foo running 1 test test _0 ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -", foo = p.url(), doctest = DOCTEST); +", foo = p.url()); assert_that(p.cargo_process("test"), execs().with_status(0) diff --git a/tests/test_cargo_install.rs b/tests/test_cargo_install.rs index 1a99fcc43..5ceeab243 100644 --- a/tests/test_cargo_install.rs +++ b/tests/test_cargo_install.rs @@ -8,7 +8,6 @@ use cargo::util::ProcessBuilder; use hamcrest::{assert_that, existing_file, is_not, Matcher, MatchResult}; use support::{project, execs}; -use support::{DOWNLOADING, INSTALLING, REPLACING, REMOVING}; use support::paths; use support::registry::Package; use support::git; @@ -85,12 +84,10 @@ test!(pick_max_version { assert_that(cargo_process("install").arg("foo"), execs().with_status(0).with_stdout(&format!("\ [UPDATING] registry `[..]` -{downloading} foo v0.0.2 (registry file://[..]) +[DOWNLOADING] foo v0.0.2 (registry file://[..]) [COMPILING] foo v0.0.2 (registry file://[..]) -{installing} {home}[..]bin[..]foo[..] +[INSTALLING] {home}[..]bin[..]foo[..] ", - downloading = DOWNLOADING, - installing = INSTALLING, home = cargo_home().display()))); assert_that(cargo_home(), has_installed_exe("foo")); }); @@ -417,9 +414,8 @@ test!(install_force { assert_that(cargo_process("install").arg("--force").arg("--path").arg(p.root()), execs().with_status(0).with_stdout(&format!("\ [COMPILING] foo v0.2.0 ([..]) -{replacing} {home}[..]bin[..]foo[..] +[REPLACING] {home}[..]bin[..]foo[..] ", - replacing = REPLACING, home = cargo_home().display()))); assert_that(cargo_process("install").arg("--list"), @@ -458,11 +454,9 @@ test!(install_force_partial_overlap { assert_that(cargo_process("install").arg("--force").arg("--path").arg(p.root()), execs().with_status(0).with_stdout(&format!("\ [COMPILING] foo v0.2.0 ([..]) -{installing} {home}[..]bin[..]foo-bin3[..] -{replacing} {home}[..]bin[..]foo-bin2[..] +[INSTALLING] {home}[..]bin[..]foo-bin3[..] +[REPLACING] {home}[..]bin[..]foo-bin2[..] ", - installing = INSTALLING, - replacing = REPLACING, home = cargo_home().display()))); assert_that(cargo_process("install").arg("--list"), @@ -508,9 +502,8 @@ test!(install_force_bin { .arg(p.root()), execs().with_status(0).with_stdout(&format!("\ [COMPILING] foo v0.2.0 ([..]) -{replacing} {home}[..]bin[..]foo-bin2[..] +[REPLACING] {home}[..]bin[..]foo-bin2[..] ", - replacing = REPLACING, home = cargo_home().display()))); assert_that(cargo_process("install").arg("--list"), @@ -562,9 +555,8 @@ test!(git_repo { execs().with_status(0).with_stdout(&format!("\ [UPDATING] git repository `[..]` [COMPILING] foo v0.1.0 ([..]) -{installing} {home}[..]bin[..]foo[..] +[INSTALLING] {home}[..]bin[..]foo[..] ", - installing = INSTALLING, home = cargo_home().display()))); assert_that(cargo_home(), has_installed_exe("foo")); assert_that(cargo_home(), has_installed_exe("foo")); @@ -627,17 +619,17 @@ test!(uninstall_piecemeal { assert_that(cargo_home(), has_installed_exe("bar")); assert_that(cargo_process("uninstall").arg("foo").arg("--bin=bar"), - execs().with_status(0).with_stdout(&format!("\ -{removing} [..]bar[..] -", removing = REMOVING))); + execs().with_status(0).with_stdout("\ +[REMOVING] [..]bar[..] +")); assert_that(cargo_home(), has_installed_exe("foo")); assert_that(cargo_home(), is_not(has_installed_exe("bar"))); assert_that(cargo_process("uninstall").arg("foo").arg("--bin=foo"), - execs().with_status(0).with_stdout(&format!("\ -{removing} [..]foo[..] -", removing = REMOVING))); + execs().with_status(0).with_stdout("\ +[REMOVING] [..]foo[..] +")); assert_that(cargo_home(), is_not(has_installed_exe("foo"))); assert_that(cargo_process("uninstall").arg("foo"), @@ -691,9 +683,9 @@ test!(do_not_rebuilds_on_local_install { assert_that(p.cargo_process("build").arg("--release"), execs().with_status(0)); assert_that(cargo_process("install").arg("--path").arg(p.root()), - execs().with_status(0).with_stdout(&format!("\ -{installing} [..] -", installing = INSTALLING)).with_stderr("\ + execs().with_status(0).with_stdout("\ +[INSTALLING] [..] +").with_stderr("\ warning: be sure to add `[..]` to your PATH to be able to run the installed binaries ")); diff --git a/tests/test_cargo_overrides.rs b/tests/test_cargo_overrides.rs index 3d8eb1097..b73ea6d5e 100644 --- a/tests/test_cargo_overrides.rs +++ b/tests/test_cargo_overrides.rs @@ -1,7 +1,7 @@ use hamcrest::assert_that; use support::registry::{registry, Package}; -use support::{execs, project, DOWNLOADING}; +use support::{execs, project}; use support::git; use support::paths; @@ -138,11 +138,11 @@ test!(transitive { execs().with_status(0).with_stdout(&format!("\ [UPDATING] registry `file://[..]` [UPDATING] git repository `[..]` -{downloading} bar v0.2.0 (registry [..]) +[DOWNLOADING] bar v0.2.0 (registry [..]) [COMPILING] foo v0.1.0 (file://[..]) [COMPILING] bar v0.2.0 (registry [..]) [COMPILING] local v0.0.1 (file://[..]) -", downloading = DOWNLOADING))); +"))); assert_that(p.cargo("build"), execs().with_status(0).with_stdout("")); }); @@ -284,13 +284,13 @@ test!(use_a_spec_to_select { execs().with_status(0).with_stdout(&format!("\ [UPDATING] registry `file://[..]` [UPDATING] git repository `[..]` -{downloading} [..] -{downloading} [..] +[DOWNLOADING] [..] +[DOWNLOADING] [..] [COMPILING] [..] [COMPILING] [..] [COMPILING] [..] [COMPILING] local v0.0.1 (file://[..]) -", downloading = DOWNLOADING))); +"))); }); test!(override_adds_some_deps { @@ -329,11 +329,11 @@ test!(override_adds_some_deps { execs().with_status(0).with_stdout(&format!("\ [UPDATING] registry `file://[..]` [UPDATING] git repository `[..]` -{downloading} foo v0.1.1 (registry [..]) +[DOWNLOADING] foo v0.1.1 (registry [..]) [COMPILING] foo v0.1.1 (registry [..]) [COMPILING] bar v0.1.0 ([..]) [COMPILING] local v0.0.1 (file://[..]) -", downloading = DOWNLOADING))); +"))); assert_that(p.cargo("build"), execs().with_status(0).with_stdout("")); diff --git a/tests/test_cargo_package.rs b/tests/test_cargo_package.rs index f608fbbcb..423a717bf 100644 --- a/tests/test_cargo_package.rs +++ b/tests/test_cargo_package.rs @@ -7,7 +7,6 @@ use git2; use tar::Archive; use support::{project, execs, paths, git, path2url}; -use support::{PACKAGING, VERIFYING, ARCHIVING}; use hamcrest::{assert_that, existing_file}; fn setup() { @@ -31,12 +30,10 @@ test!(simple { assert_that(p.cargo_process("package"), execs().with_status(0).with_stdout(&format!("\ -{packaging} foo v0.0.1 ({dir}) -{verifying} foo v0.0.1 ({dir}) +[PACKAGING] foo v0.0.1 ({dir}) +[VERIFYING] foo v0.0.1 ({dir}) [COMPILING] foo v0.0.1 ({dir}[..]) ", - packaging = PACKAGING, - verifying = VERIFYING, dir = p.url()))); assert_that(&p.root().join("target/package/foo-0.0.1.crate"), existing_file()); assert_that(p.cargo("package").arg("-l"), @@ -75,12 +72,10 @@ test!(metadata_warning { "#); assert_that(p.cargo_process("package"), execs().with_status(0).with_stdout(&format!("\ -{packaging} foo v0.0.1 ({dir}) -{verifying} foo v0.0.1 ({dir}) +[PACKAGING] foo v0.0.1 ({dir}) +[VERIFYING] foo v0.0.1 ({dir}) [COMPILING] foo v0.0.1 ({dir}[..]) ", - packaging = PACKAGING, - verifying = VERIFYING, dir = p.url())) .with_stderr("\ warning: manifest has no description, license, license-file, documentation, \ @@ -100,12 +95,10 @@ http://doc.crates.io/manifest.html#package-metadata for more info.")); "#); assert_that(p.cargo_process("package"), execs().with_status(0).with_stdout(&format!("\ -{packaging} foo v0.0.1 ({dir}) -{verifying} foo v0.0.1 ({dir}) +[PACKAGING] foo v0.0.1 ({dir}) +[VERIFYING] foo v0.0.1 ({dir}) [COMPILING] foo v0.0.1 ({dir}[..]) ", - packaging = PACKAGING, - verifying = VERIFYING, dir = p.url())) .with_stderr("\ warning: manifest has no description, documentation, homepage or repository. See \ @@ -126,12 +119,10 @@ http://doc.crates.io/manifest.html#package-metadata for more info.")); "#); assert_that(p.cargo_process("package"), execs().with_status(0).with_stdout(&format!("\ -{packaging} foo v0.0.1 ({dir}) -{verifying} foo v0.0.1 ({dir}) +[PACKAGING] foo v0.0.1 ({dir}) +[VERIFYING] foo v0.0.1 ({dir}) [COMPILING] foo v0.0.1 ({dir}[..]) ", - packaging = PACKAGING, - verifying = VERIFYING, dir = p.url()))); }); @@ -161,24 +152,20 @@ test!(package_verbose { println!("package main repo"); assert_that(cargo.clone().arg("package").arg("-v").arg("--no-verify"), - execs().with_status(0).with_stdout(&format!("\ -{packaging} foo v0.0.1 ([..]) -{archiving} [..] -{archiving} [..] -", - packaging = PACKAGING, - archiving = ARCHIVING))); + execs().with_status(0).with_stdout("\ +[PACKAGING] foo v0.0.1 ([..]) +[ARCHIVING] [..] +[ARCHIVING] [..] +")); println!("package sub-repo"); assert_that(cargo.arg("package").arg("-v").arg("--no-verify") .cwd(p.root().join("a")), - execs().with_status(0).with_stdout(&format!("\ -{packaging} a v0.0.1 ([..]) -{archiving} [..] -{archiving} [..] -", - packaging = PACKAGING, - archiving = ARCHIVING))); + execs().with_status(0).with_stdout("\ +[PACKAGING] a v0.0.1 ([..]) +[ARCHIVING] [..] +[ARCHIVING] [..] +")); }); test!(package_verification { @@ -196,12 +183,10 @@ test!(package_verification { execs().with_status(0)); assert_that(p.cargo("package"), execs().with_status(0).with_stdout(&format!("\ -{packaging} foo v0.0.1 ({dir}) -{verifying} foo v0.0.1 ({dir}) +[PACKAGING] foo v0.0.1 ({dir}) +[VERIFYING] foo v0.0.1 ({dir}) [COMPILING] foo v0.0.1 ({dir}[..]) ", - packaging = PACKAGING, - verifying = VERIFYING, dir = p.url()))); }); @@ -221,11 +206,11 @@ test!(exclude { .file("src/bar.txt", ""); assert_that(p.cargo_process("package").arg("--no-verify").arg("-v"), - execs().with_status(0).with_stdout(&format!("\ -{packaging} foo v0.0.1 ([..]) -{archiving} [..] -{archiving} [..] -", packaging = PACKAGING, archiving = ARCHIVING))); + execs().with_status(0).with_stdout("\ +[PACKAGING] foo v0.0.1 ([..]) +[ARCHIVING] [..] +[ARCHIVING] [..] +")); }); test!(include { @@ -245,12 +230,12 @@ test!(include { .file("src/bar.txt", ""); // should be ignored when packaging assert_that(p.cargo_process("package").arg("--no-verify").arg("-v"), - execs().with_status(0).with_stdout(&format!("\ -{packaging} foo v0.0.1 ([..]) -{archiving} [..] -{archiving} [..] -{archiving} [..] -", packaging = PACKAGING, archiving = ARCHIVING))); + execs().with_status(0).with_stdout("\ +[PACKAGING] foo v0.0.1 ([..]) +[ARCHIVING] [..] +[ARCHIVING] [..] +[ARCHIVING] [..] +")); }); test!(package_lib_with_bin { @@ -284,16 +269,14 @@ test!(package_new_git_repo { assert_that(::cargo_process().arg("package").cwd(p.root()) .arg("--no-verify").arg("-v"), - execs().with_status(0).with_stdout(&format!("\ -{packaging} foo v0.0.1 ([..]) -{archiving} [..] -{archiving} [..] -", packaging = PACKAGING, archiving = ARCHIVING))); + execs().with_status(0).with_stdout("\ +[PACKAGING] foo v0.0.1 ([..]) +[ARCHIVING] [..] +[ARCHIVING] [..] +")); }); test!(package_git_submodule { - use std::str::from_utf8; - let project = git::new("foo", |project| { project.file("Cargo.toml", r#" [project] @@ -319,9 +302,9 @@ test!(package_git_submodule { repository.reset(&repository.revparse_single("HEAD").unwrap(), git2::ResetType::Hard, None).unwrap(); - let result = project.cargo("package").arg("--no-verify").arg("-v").exec_with_output().unwrap(); - assert!(result.status.success()); - assert!(from_utf8(&result.stdout).unwrap().contains(&format!("{} bar/Makefile", ARCHIVING))); + assert_that(::cargo_process().arg("package").cwd(project.root()) + .arg("--no-verify").arg("-v"), + execs().with_status(0).with_stdout_contains("[ARCHIVING] bar/Makefile")); }); test!(no_duplicates_from_modified_tracked_files { @@ -372,12 +355,10 @@ test!(ignore_nested { assert_that(p.cargo_process("package"), execs().with_status(0).with_stdout(&format!("\ -{packaging} nested v0.0.1 ({dir}) -{verifying} nested v0.0.1 ({dir}) +[PACKAGING] nested v0.0.1 ({dir}) +[VERIFYING] nested v0.0.1 ({dir}) [COMPILING] nested v0.0.1 ({dir}[..]) ", - packaging = PACKAGING, - verifying = VERIFYING, dir = p.url()))); assert_that(&p.root().join("target/package/nested-0.0.1.crate"), existing_file()); assert_that(p.cargo("package").arg("-l"), diff --git a/tests/test_cargo_publish.rs b/tests/test_cargo_publish.rs index d6b2fc7e8..ae164feb3 100644 --- a/tests/test_cargo_publish.rs +++ b/tests/test_cargo_publish.rs @@ -8,7 +8,6 @@ use tar::Archive; use url::Url; use support::{project, execs}; -use support::{PACKAGING, UPLOADING}; use support::paths; use support::git::repo; @@ -52,11 +51,9 @@ test!(simple { assert_that(p.cargo_process("publish").arg("--no-verify"), execs().with_status(0).with_stdout(&format!("\ [UPDATING] registry `{reg}` -{packaging} foo v0.0.1 ({dir}) -{uploading} foo v0.0.1 ({dir}) +[PACKAGING] foo v0.0.1 ({dir}) +[UPLOADING] foo v0.0.1 ({dir}) ", - uploading = UPLOADING, - packaging = PACKAGING, dir = p.url(), reg = registry()))); diff --git a/tests/test_cargo_registry.rs b/tests/test_cargo_registry.rs index 254007c7b..3dbc51ca0 100644 --- a/tests/test_cargo_registry.rs +++ b/tests/test_cargo_registry.rs @@ -2,7 +2,6 @@ use std::fs::{self, File}; use std::io::prelude::*; use support::{project, execs}; -use support::{DOWNLOADING, PACKAGING, VERIFYING, ADDING, REMOVING}; use support::paths::{self, CargoPathExt}; use support::registry::{self, Package}; use support::git; @@ -30,11 +29,10 @@ test!(simple { assert_that(p.cargo_process("build"), execs().with_status(0).with_stdout(&format!("\ [UPDATING] registry `{reg}` -{downloading} bar v0.0.1 (registry file://[..]) +[DOWNLOADING] bar v0.0.1 (registry file://[..]) [COMPILING] bar v0.0.1 (registry file://[..]) [COMPILING] foo v0.0.1 ({dir}) ", - downloading = DOWNLOADING, dir = p.url(), reg = registry::registry()))); @@ -68,13 +66,12 @@ test!(deps { assert_that(p.cargo_process("build"), execs().with_status(0).with_stdout(&format!("\ [UPDATING] registry `{reg}` -{downloading} [..] v0.0.1 (registry file://[..]) -{downloading} [..] v0.0.1 (registry file://[..]) +[DOWNLOADING] [..] v0.0.1 (registry file://[..]) +[DOWNLOADING] [..] v0.0.1 (registry file://[..]) [COMPILING] baz v0.0.1 (registry file://[..]) [COMPILING] bar v0.0.1 (registry file://[..]) [COMPILING] foo v0.0.1 ({dir}) ", - downloading = DOWNLOADING, dir = p.url(), reg = registry::registry()))); }); @@ -194,11 +191,10 @@ version required: >= 0.0.0 assert_that(p.cargo("build"), execs().with_status(0).with_stdout(&format!("\ [UPDATING] registry `{reg}` -{downloading} notyet v0.0.1 (registry file://[..]) +[DOWNLOADING] notyet v0.0.1 (registry file://[..]) [COMPILING] notyet v0.0.1 (registry file://[..]) [COMPILING] foo v0.0.1 ({dir}) ", - downloading = DOWNLOADING, dir = p.url(), reg = registry::registry()))); }); @@ -244,18 +240,13 @@ version required: ^0.0.1 assert_that(p.cargo("package"), execs().with_status(0).with_stdout(format!("\ -{packaging} foo v0.0.1 ({dir}) -{verifying} foo v0.0.1 ({dir}) +[PACKAGING] foo v0.0.1 ({dir}) +[VERIFYING] foo v0.0.1 ({dir}) [UPDATING] registry `[..]` -{downloading} notyet v0.0.1 (registry file://[..]) +[DOWNLOADING] notyet v0.0.1 (registry file://[..]) [COMPILING] notyet v0.0.1 (registry file://[..]) [COMPILING] foo v0.0.1 ({dir}[..]) -", - packaging = PACKAGING, - verifying = VERIFYING, - downloading = DOWNLOADING, - dir = p.url(), -))); +", dir = p.url()))); }); test!(lockfile_locks { @@ -277,10 +268,10 @@ test!(lockfile_locks { assert_that(p.cargo("build"), execs().with_status(0).with_stdout(&format!("\ [UPDATING] registry `[..]` -{downloading} bar v0.0.1 (registry file://[..]) +[DOWNLOADING] bar v0.0.1 (registry file://[..]) [COMPILING] bar v0.0.1 (registry file://[..]) [COMPILING] foo v0.0.1 ({dir}) -", downloading = DOWNLOADING, +", dir = p.url()))); p.root().move_into_the_past().unwrap(); @@ -310,12 +301,12 @@ test!(lockfile_locks_transitively { assert_that(p.cargo("build"), execs().with_status(0).with_stdout(&format!("\ [UPDATING] registry `[..]` -{downloading} [..] v0.0.1 (registry file://[..]) -{downloading} [..] v0.0.1 (registry file://[..]) +[DOWNLOADING] [..] v0.0.1 (registry file://[..]) +[DOWNLOADING] [..] v0.0.1 (registry file://[..]) [COMPILING] baz v0.0.1 (registry file://[..]) [COMPILING] bar v0.0.1 (registry file://[..]) [COMPILING] foo v0.0.1 ({dir}) -", downloading = DOWNLOADING, +", dir = p.url()))); p.root().move_into_the_past().unwrap(); @@ -348,12 +339,12 @@ test!(yanks_are_not_used { assert_that(p.cargo("build"), execs().with_status(0).with_stdout(&format!("\ [UPDATING] registry `[..]` -{downloading} [..] v0.0.1 (registry file://[..]) -{downloading} [..] v0.0.1 (registry file://[..]) +[DOWNLOADING] [..] v0.0.1 (registry file://[..]) +[DOWNLOADING] [..] v0.0.1 (registry file://[..]) [COMPILING] baz v0.0.1 (registry file://[..]) [COMPILING] bar v0.0.1 (registry file://[..]) [COMPILING] foo v0.0.1 ({dir}) -", downloading = DOWNLOADING, +", dir = p.url()))); }); @@ -441,8 +432,8 @@ test!(update_with_lockfile_if_packages_missing { assert_that(p.cargo("build"), execs().with_status(0).with_stdout(&format!("\ [UPDATING] registry `[..]` -{downloading} bar v0.0.1 (registry file://[..]) -", downloading = DOWNLOADING))); +[DOWNLOADING] bar v0.0.1 (registry file://[..]) +"))); }); test!(update_lockfile { @@ -478,10 +469,10 @@ test!(update_lockfile { println!("0.0.2 build"); assert_that(p.cargo("build"), execs().with_status(0).with_stdout(&format!("\ -{downloading} [..] v0.0.2 (registry file://[..]) +[DOWNLOADING] [..] v0.0.2 (registry file://[..]) [COMPILING] bar v0.0.2 (registry file://[..]) [COMPILING] foo v0.0.1 ({dir}) -", downloading = DOWNLOADING, +", dir = p.url()))); println!("0.0.3 update"); @@ -495,10 +486,10 @@ test!(update_lockfile { println!("0.0.3 build"); assert_that(p.cargo("build"), execs().with_status(0).with_stdout(&format!("\ -{downloading} [..] v0.0.3 (registry file://[..]) +[DOWNLOADING] [..] v0.0.3 (registry file://[..]) [COMPILING] bar v0.0.3 (registry file://[..]) [COMPILING] foo v0.0.1 ({dir}) -", downloading = DOWNLOADING, +", dir = p.url()))); println!("new dependencies update"); @@ -506,21 +497,21 @@ test!(update_lockfile { Package::new("spam", "0.2.5").publish(); assert_that(p.cargo("update") .arg("-p").arg("bar"), - execs().with_status(0).with_stdout(&format!("\ + execs().with_status(0).with_stdout("\ [UPDATING] registry `[..]` [UPDATING] bar v0.0.3 (registry file://[..]) -> v0.0.4 -{adding} spam v0.2.5 (registry file://[..]) -", adding = ADDING))); +[ADDING] spam v0.2.5 (registry file://[..]) +")); println!("new dependencies update"); Package::new("bar", "0.0.5").publish(); assert_that(p.cargo("update") .arg("-p").arg("bar"), - execs().with_status(0).with_stdout(&format!("\ + execs().with_status(0).with_stdout("\ [UPDATING] registry `[..]` [UPDATING] bar v0.0.4 (registry file://[..]) -> v0.0.5 -{removing} spam v0.2.5 (registry file://[..]) -", removing = REMOVING))); +[REMOVING] spam v0.2.5 (registry file://[..]) +")); }); test!(dev_dependency_not_used { @@ -543,10 +534,10 @@ test!(dev_dependency_not_used { assert_that(p.cargo("build"), execs().with_status(0).with_stdout(&format!("\ [UPDATING] registry `[..]` -{downloading} [..] v0.0.1 (registry file://[..]) +[DOWNLOADING] [..] v0.0.1 (registry file://[..]) [COMPILING] bar v0.0.1 (registry file://[..]) [COMPILING] foo v0.0.1 ({dir}) -", downloading = DOWNLOADING, +", dir = p.url()))); }); @@ -607,11 +598,11 @@ test!(updating_a_dep { assert_that(p.cargo("build"), execs().with_status(0).with_stdout(&format!("\ [UPDATING] registry `[..]` -{downloading} bar v0.0.1 (registry file://[..]) +[DOWNLOADING] bar v0.0.1 (registry file://[..]) [COMPILING] bar v0.0.1 (registry file://[..]) [COMPILING] a v0.0.1 ({dir}/a) [COMPILING] foo v0.0.1 ({dir}) -", downloading = DOWNLOADING, +", dir = p.url()))); File::create(&p.root().join("a/Cargo.toml")).unwrap().write_all(br#" @@ -629,11 +620,11 @@ test!(updating_a_dep { assert_that(p.cargo("build"), execs().with_status(0).with_stdout(&format!("\ [UPDATING] registry `[..]` -{downloading} bar v0.1.0 (registry file://[..]) +[DOWNLOADING] bar v0.1.0 (registry file://[..]) [COMPILING] bar v0.1.0 (registry file://[..]) [COMPILING] a v0.0.1 ({dir}/a) [COMPILING] foo v0.0.1 ({dir}) -", downloading = DOWNLOADING, +", dir = p.url()))); }); @@ -673,11 +664,11 @@ test!(git_and_registry_dep { execs().with_status(0).with_stdout(&format!("\ [UPDATING] [..] [UPDATING] [..] -{downloading} a v0.0.1 (registry file://[..]) +[DOWNLOADING] a v0.0.1 (registry file://[..]) [COMPILING] a v0.0.1 (registry [..]) [COMPILING] b v0.0.1 ([..]) [COMPILING] foo v0.0.1 ({dir}) -", downloading = DOWNLOADING, +", dir = p.url()))); p.root().move_into_the_past().unwrap(); @@ -718,10 +709,10 @@ test!(update_publish_then_update { assert_that(p.cargo("build"), execs().with_status(0).with_stdout(&format!("\ [UPDATING] [..] -{downloading} a v0.1.1 (registry file://[..]) +[DOWNLOADING] a v0.1.1 (registry file://[..]) [COMPILING] a v0.1.1 (registry [..]) [COMPILING] foo v0.5.0 ({dir}) -", downloading = DOWNLOADING, +", dir = p.url()))); }); @@ -746,8 +737,8 @@ test!(fetch_downloads { execs().with_status(0) .with_stdout(format!("\ [UPDATING] registry `[..]` -{downloading} a v0.1.0 (registry [..]) -", downloading = DOWNLOADING))); +[DOWNLOADING] a v0.1.0 (registry [..]) +"))); }); test!(update_transitive_dependency { @@ -782,11 +773,11 @@ test!(update_transitive_dependency { assert_that(p.cargo("build"), execs().with_status(0) .with_stdout(format!("\ -{downloading} b v0.1.1 (registry file://[..]) +[DOWNLOADING] b v0.1.1 (registry file://[..]) [COMPILING] b v0.1.1 (registry [..]) [COMPILING] a v0.1.0 (registry [..]) [COMPILING] foo v0.5.0 ([..]) -", downloading = DOWNLOADING))); +"))); }); test!(update_backtracking_ok { @@ -870,11 +861,11 @@ test!(update_multiple_packages { assert_that(p.cargo("build"), execs().with_status(0) .with_stdout_contains(format!("\ -{downloading} a v0.1.1 (registry file://[..])", downloading = DOWNLOADING)) +[DOWNLOADING] a v0.1.1 (registry file://[..])")) .with_stdout_contains(format!("\ -{downloading} b v0.1.1 (registry file://[..])", downloading = DOWNLOADING)) +[DOWNLOADING] b v0.1.1 (registry file://[..])")) .with_stdout_contains(format!("\ -{downloading} c v0.1.1 (registry file://[..])", downloading = DOWNLOADING)) +[DOWNLOADING] c v0.1.1 (registry file://[..])")) .with_stdout_contains(format!("\ [COMPILING] a v0.1.1 (registry [..])")) .with_stdout_contains(format!("\ @@ -993,10 +984,10 @@ test!(only_download_relevant { assert_that(p.cargo("build"), execs().with_status(0).with_stdout(&format!("\ [UPDATING] registry `[..]` -{downloading} baz v0.1.0 ([..]) +[DOWNLOADING] baz v0.1.0 ([..]) [COMPILING] baz v0.1.0 ([..]) [COMPILING] bar v0.5.0 ([..]) -", downloading = DOWNLOADING))); +"))); }); test!(resolve_and_backtracking { diff --git a/tests/test_cargo_test.rs b/tests/test_cargo_test.rs index e402de82f..ab64d7acc 100644 --- a/tests/test_cargo_test.rs +++ b/tests/test_cargo_test.rs @@ -3,7 +3,6 @@ use std::io::prelude::*; use std::str; use support::{project, execs, basic_bin_manifest, basic_lib_manifest}; -use support::{DOCTEST}; use support::paths::CargoPathExt; use hamcrest::{assert_that, existing_file, is_not}; use cargo::util::process; @@ -100,14 +99,14 @@ test test ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -{doctest} foo +[DOCTEST] foo [RUNNING] `rustdoc --test [..]lib.rs[..]` running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured -", dir = p.url(), doctest = DOCTEST))); +", dir = p.url()))); }); test!(cargo_test_verbose { @@ -258,7 +257,7 @@ test lib_test ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -{doctest} foo +[DOCTEST] foo running 1 test test foo_0 ... ok @@ -266,7 +265,7 @@ test foo_0 ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured ", - p.url(), doctest = DOCTEST))) + p.url()))) }); test!(test_with_deep_lib_dep { @@ -319,7 +318,7 @@ test bar_test ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -{doctest} bar +[DOCTEST] bar running 1 test test bar_0 ... ok @@ -327,7 +326,6 @@ test bar_0 ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured ", - doctest = DOCTEST, dir = p.url()))); }); @@ -373,14 +371,14 @@ test external_test ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -{doctest} foo +[DOCTEST] foo running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured ", - p.url(), doctest = DOCTEST))) + p.url()))) }); test!(external_test_implicit { @@ -421,13 +419,13 @@ test internal_test ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -{doctest} foo +[DOCTEST] foo running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured -", p.url(), doctest = DOCTEST))) +", p.url()))) }); test!(dont_run_examples { @@ -471,14 +469,13 @@ test bar ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -{doctest} foo +[DOCTEST] foo running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured ", - doctest = DOCTEST, dir = p.url()))); assert_that(p.cargo("test").arg("foo"), @@ -491,14 +488,13 @@ test foo ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -{doctest} foo +[DOCTEST] foo running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured -", - doctest = DOCTEST))); +"))); }); // Regression test for running cargo-test twice with @@ -561,14 +557,14 @@ test [..] ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -{doctest} foo +[DOCTEST] foo running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured ", - p.url(), doctest = DOCTEST))) + p.url()))) }); test!(lib_with_standard_name { @@ -613,15 +609,14 @@ test test ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -{doctest} syntax +[DOCTEST] syntax running 1 test test foo_0 ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -", - doctest = DOCTEST, dir = p.url()))); +", dir = p.url()))); }); test!(lib_with_standard_name2 { @@ -1007,14 +1002,13 @@ test foo ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -{doctest} foo +[DOCTEST] foo running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured ", - doctest = DOCTEST, dir = p.url()))); assert_that(p.cargo("test"), @@ -1027,14 +1021,13 @@ test foo ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -{doctest} foo +[DOCTEST] foo running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured -", - doctest = DOCTEST))); +"))); }); test!(test_then_build { @@ -1061,14 +1054,13 @@ test foo ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -{doctest} foo +[DOCTEST] foo running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured ", - doctest = DOCTEST, dir = p.url()))); assert_that(p.cargo("build"), @@ -1443,14 +1435,13 @@ running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured -{doctest} d1 +[DOCTEST] d1 running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured -", dir = p.url(), - doctest = DOCTEST))); +", dir = p.url()))); }); test!(example_bin_same_name { @@ -1614,14 +1605,14 @@ running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured -{doctest} foo +[DOCTEST] foo running 1 test test foo_0 ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -", doctest = DOCTEST))) +"))) }); test!(dashes_to_underscores { @@ -1723,14 +1714,14 @@ test!(dylib_doctest { assert_that(p.cargo_process("test"), execs().with_stdout(format!("\ [COMPILING] foo v0.0.1 ([..]) -{doctest} foo +[DOCTEST] foo running 1 test test foo_0 ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -", doctest = DOCTEST))); +"))); }); test!(dylib_doctest2 { @@ -1796,14 +1787,14 @@ running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured -{doctest} foo +[DOCTEST] foo running 1 test test _0 ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -", doctest = DOCTEST))) +"))) }); test!(dev_dep_with_build_script { @@ -1898,14 +1889,14 @@ test sub_one_test ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -{doctest} foo +[DOCTEST] foo running 1 test test sub_one_0 ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured -", doctest = DOCTEST))) +"))) }); test!(test_multiple_packages { -- 2.30.2